<template>
	<view>
		<l-painter ref="painter" hidden></l-painter>
	</view>
</template>

<script>
	import { setPosterInfo } from './layout.js';
	export default {
		name:"shareToFriends",
		data() {
			return {
				
			};
		},
		methods: {
			startRender (goodsInfo) {
				uni.showLoading({
					title: '打开中'
				})
				let layoutObj = setPosterInfo(goodsInfo);
				return new Promise((resolve, reject) => {
					this.$refs.painter.render(layoutObj);
					this.$refs.painter.canvasToTempFilePathSync({
						fileType: "jpg",
						pathType: 'url',
						quality: 1,
						success: (res) => {
							uni.hideLoading();
							resolve(res.tempFilePath);
						},
					});
				})
			}
		}
	}
</script>

<style lang="scss">

</style>